<?php

namespace Action\User;

class Feed extends \Library\Action\UserAction 
	implements \Library\Action\AjaxAction {

	private $_user = null;
	private $_feed = null;


	public function getUserId() {
		return $this->getParam( 'id' );
	}
	
	public function getUser() {
		if( $this->_user === null ) {
			$this->_user = \Bean\User::get( $this->getUserId() );
		}
		return $this->_user;
	}

	public function getFeed() {
		if( $this->_feed === null ) {
			$this->_feed = new \Bean\Flow\FeedFlow( _u(), array(
				\Bean\Flow\PostsFlow::getFlow( array(
					'flow_id' => $this->getUser()->getFlowId(),
					'type' => 'User'
				) ),
				new \Bean\Flow\PostsFlow\ContactsFlow( _u() )
			) );
		}
		return $this->_feed;
	}


}
